generic module HookSenderP (am_id_t AMId){
	provides{
		interface AMSend;
		interface Packet;
		interface AMPacket;
		interface PacketAcknowledgements as Acks;
	}
	uses{
		interface AMSend as AMSendM;
		interface Packet as PacketM;
		interface AMPacket as AMPacketM;
		interface PacketAcknowledgements as AcksM;
	}
}
implementation{	

	//AMSend
	command error_t AMSend.send(am_addr_t dest, message_t* msg, uint8_t len){
		return call AMSendM.send(dest, msg, len);//trimite la urmatoarea componenta
	}
	
	command error_t AMSend.cancel(message_t* msg){
	
		return call AMSendM.cancel(msg);
	}
		
	command uint8_t AMSend.maxPayloadLength(){
	
		return call AMSendM.maxPayloadLength();
	}
	
	command void* AMSend.getPayload(message_t* msg, uint8_t len){
		
		return call AMSendM.getPayload(msg,len);
	}
	
	//Packet
	command void Packet.clear(message_t* msg){
		
		return call PacketM.clear(msg);
	}
	
	command uint8_t Packet.payloadLength(message_t* msg){
		return call PacketM.payloadLength(msg);
	}
	
	command void Packet.setPayloadLength(message_t* msg, uint8_t len){
		return call PacketM.setPayloadLength(msg,len);
	}
	
	command uint8_t Packet.maxPayloadLength(){
		return call Packet.maxPayloadLength();
	}
	
	command void* Packet.getPayload(message_t* msg, uint8_t len){
		return call PacketM.getPayload(msg,len);
	}

	//AMPacket
	command am_addr_t AMPacket.address(){
		return call AMPacketM.address();
	}
	
	command am_addr_t AMPacket.destination(message_t* amsg){
		return call AMPacketM.destination(amsg);
	}
	
	command am_addr_t AMPacket.source(message_t* amsg){
		return call AMPacketM.source(amsg);
	}
	
	command void AMPacket.setDestination(message_t* amsg, am_addr_t addr){
		return call AMPacketM.setDestination(amsg, addr);
	}
	
	command void AMPacket.setSource(message_t* amsg, am_addr_t addr){
		return call AMPacketM.setSource(amsg, addr);
	}
	
	command bool AMPacket.isForMe(message_t* amsg){
		return call AMPacketM.isForMe(amsg);
	}
	
	command am_id_t AMPacket.type(message_t* amsg){
		return call AMPacketM.type(amsg);
	}
	
	command void AMPacket.setType(message_t* amsg, am_id_t t){
		return call AMPacketM.setType(amsg, t);
	}
	
	command am_group_t AMPacket.group(message_t* amsg){
		return call AMPacketM.group(amsg);
	}
	
	command void AMPacket.setGroup(message_t* amsg, am_group_t grp){
		return call AMPacketM.setGroup(amsg, grp);
	}
	
	command am_group_t AMPacket.localGroup(){
		return call AMPacketM.localGroup();
	}
	
	//PacketAcknowledgements
	async command error_t Acks.requestAck( message_t* msg ){
		return call AcksM.requestAck(msg );
	}	
	
	async command error_t Acks.noAck( message_t* msg ){
		return call AcksM.noAck(msg);
	}
	
	async command bool Acks.wasAcked(message_t* msg){
		return call AcksM.wasAcked(msg);
	}	
	
	event void AMSendM.sendDone(message_t* msg, error_t error){
		signal AMSend.sendDone(msg,error);
	}
		
}
